import 'package:kepu/generated/json/base/json_convert_content.dart';
import 'package:kepu/model/animal_type_entity.dart';

AnimalTypeEntity $AnimalTypeEntityFromJson(Map<String, dynamic> json) {
  final AnimalTypeEntity animalTypeEntity = AnimalTypeEntity();
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    animalTypeEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    animalTypeEntity.msg = msg;
  }
  final List<AnimalTypeData>? data = (json['data'] as List<dynamic>?)
      ?.map(
          (e) => jsonConvert.convert<AnimalTypeData>(e) as AnimalTypeData)
      .toList();
  if (data != null) {
    animalTypeEntity.data = data;
  }
  return animalTypeEntity;
}

Map<String, dynamic> $AnimalTypeEntityToJson(AnimalTypeEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  data['data'] = entity.data.map((v) => v.toJson()).toList();
  return data;
}

extension AnimalTypeEntityExtension on AnimalTypeEntity {
  AnimalTypeEntity copyWith({
    int? code,
    String? msg,
    List<AnimalTypeData>? data,
  }) {
    return AnimalTypeEntity()
      ..code = code ?? this.code
      ..msg = msg ?? this.msg
      ..data = data ?? this.data;
  }
}

AnimalTypeData $AnimalTypeDataFromJson(Map<String, dynamic> json) {
  final AnimalTypeData animalTypeData = AnimalTypeData();
  final int? animaltypeId = jsonConvert.convert<int>(json['animaltypeId']);
  if (animaltypeId != null) {
    animalTypeData.animaltypeId = animaltypeId;
  }
  final String? animaltypeContent = jsonConvert.convert<String>(
      json['animaltypeContent']);
  if (animaltypeContent != null) {
    animalTypeData.animaltypeContent = animaltypeContent;
  }
  return animalTypeData;
}

Map<String, dynamic> $AnimalTypeDataToJson(AnimalTypeData entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['animaltypeId'] = entity.animaltypeId;
  data['animaltypeContent'] = entity.animaltypeContent;
  return data;
}

extension AnimalTypeDataExtension on AnimalTypeData {
  AnimalTypeData copyWith({
    int? animaltypeId,
    String? animaltypeContent,
  }) {
    return AnimalTypeData()
      ..animaltypeId = animaltypeId ?? this.animaltypeId
      ..animaltypeContent = animaltypeContent ?? this.animaltypeContent;
  }
}